<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="备注" prop="remarks">
        <el-input
          v-model="queryParams.remarks"
          placeholder="请输入备注"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="年度" prop="awardYear">
        <el-date-picker clearable
                        v-model="queryParams.awardYear"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择年度">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="创建时间">
        <el-date-picker
          v-model="daterangeCreateTime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="人员编号" prop="employeeId">
        <el-input
          v-model="queryParams.employeeId"
          placeholder="请输入人员编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="单位名称" prop="companyName">
        <el-input
          v-model="queryParams.companyName"
          placeholder="请输入单位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="部门名称" prop="departmentName">
        <el-input
          v-model="queryParams.departmentName"
          placeholder="请输入部门名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="班组/处室" prop="teamOffice">
        <el-input
          v-model="queryParams.teamOffice"
          placeholder="请输入班组/处室"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="岗位名称" prop="positionName">
        <el-input
          v-model="queryParams.positionName"
          placeholder="请输入岗位名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="岗位大类" prop="positionCategoryMajor">
        <el-input
          v-model="queryParams.positionCategoryMajor"
          placeholder="请输入岗位大类"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="岗位中类" prop="positionCategoryMinor">
        <el-input
          v-model="queryParams.positionCategoryMinor"
          placeholder="请输入岗位中类"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="性别 男 女" prop="gender">
        <el-input
          v-model="queryParams.gender"
          placeholder="请输入性别 男 女"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="民族" prop="ethnicity">
        <el-input
          v-model="queryParams.ethnicity"
          placeholder="请输入民族"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出生日期" prop="birthDate">
        <el-date-picker clearable
                        v-model="queryParams.birthDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择出生日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="年龄" prop="age">
        <el-input
          v-model="queryParams.age"
          placeholder="请输入年龄"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="参加工作时间" prop="workStartDate">
        <el-date-picker clearable
                        v-model="queryParams.workStartDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择参加工作时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="工龄起算日期" prop="workTenureStartDate">
        <el-date-picker clearable
                        v-model="queryParams.workTenureStartDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择工龄起算日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="进入电力行业时间" prop="entryPowerIndustryDate">
        <el-date-picker clearable
                        v-model="queryParams.entryPowerIndustryDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择进入电力行业时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="进入本单位时间" prop="entryCompanyDate">
        <el-date-picker clearable
                        v-model="queryParams.entryCompanyDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择进入本单位时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="最高学历毕业时间" prop="highestEducationGraduationDate">
        <el-date-picker clearable
                        v-model="queryParams.highestEducationGraduationDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择最高学历毕业时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="最高学历学校名称" prop="highestEducationSchoolName">
        <el-input
          v-model="queryParams.highestEducationSchoolName"
          placeholder="请输入最高学历学校名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高学历所学专业名称" prop="highestEducationMajor">
        <el-input
          v-model="queryParams.highestEducationMajor"
          placeholder="请输入最高学历所学专业名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高学历学习形式 全日制, 函授, 在职, 自学考试, 网络教育, 成人教育" prop="highestEducationForm">
        <el-input
          v-model="queryParams.highestEducationForm"
          placeholder="请输入最高学历学习形式 全日制, 函授, 在职, 自学考试, 网络教育, 成人教育"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高学历" prop="highestEducationDegree">
        <el-input
          v-model="queryParams.highestEducationDegree"
          placeholder="请输入最高学历"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="最高学位" prop="highestEducationTitle">
        <el-input
          v-model="queryParams.highestEducationTitle"
          placeholder="请输入最高学位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="就业学历毕业时间" prop="employmentEducationGraduationDate">
        <el-date-picker clearable
                        v-model="queryParams.employmentEducationGraduationDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择就业学历毕业时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="就业学历学校名称" prop="employmentEducationSchoolName">
        <el-input
          v-model="queryParams.employmentEducationSchoolName"
          placeholder="请输入就业学历学校名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="就业学历所学专业名称" prop="employmentEducationMajor">
        <el-input
          v-model="queryParams.employmentEducationMajor"
          placeholder="请输入就业学历所学专业名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="就业学历" prop="employmentEducationDegree">
        <el-input
          v-model="queryParams.employmentEducationDegree"
          placeholder="请输入就业学历"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="就业学位" prop="employmentEducationTitle">
        <el-input
          v-model="queryParams.employmentEducationTitle"
          placeholder="请输入就业学位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="政治面貌" prop="politicalAffiliation">
        <el-input
          v-model="queryParams.politicalAffiliation"
          placeholder="请输入政治面貌"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="入组织时间" prop="partyEntryDate">
        <el-date-picker clearable
                        v-model="queryParams.partyEntryDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择入组织时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="转正时间" prop="probationEndDate">
        <el-date-picker clearable
                        v-model="queryParams.probationEndDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择转正时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="专家等级" prop="expertLevel">
        <el-input
          v-model="queryParams.expertLevel"
          placeholder="请输入专家等级"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专家类别" prop="expertCategory">
        <el-input
          v-model="queryParams.expertCategory"
          placeholder="请输入专家类别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业技术资格名称" prop="professionalQualificationName">
        <el-input
          v-model="queryParams.professionalQualificationName"
          placeholder="请输入专业技术资格名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业技术资格系列" prop="professionalQualificationSeries">
        <el-input
          v-model="queryParams.professionalQualificationSeries"
          placeholder="请输入专业技术资格系列"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专业技术资格等级" prop="professionalQualificationLevel">
        <el-input
          v-model="queryParams.professionalQualificationLevel"
          placeholder="请输入专业技术资格等级"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="取得资格时间" prop="qualificationObtainDate">
        <el-date-picker clearable
                        v-model="queryParams.qualificationObtainDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择取得资格时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="技能鉴定工种" prop="skillIdentificationTrade">
        <el-input
          v-model="queryParams.skillIdentificationTrade"
          placeholder="请输入技能鉴定工种"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="技能等级" prop="skillLevel">
        <el-input
          v-model="queryParams.skillLevel"
          placeholder="请输入技能等级"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="资格获得时间" prop="skillQualificationObtainDate">
        <el-date-picker clearable
                        v-model="queryParams.skillQualificationObtainDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择资格获得时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="任职时间" prop="appointmentDate">
        <el-date-picker clearable
                        v-model="queryParams.appointmentDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择任职时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="现职务名称" prop="currentPositionName">
        <el-input
          v-model="queryParams.currentPositionName"
          placeholder="请输入现职务名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专家称号批准时间" prop="expertTitleApprovalDate">
        <el-date-picker clearable
                        v-model="queryParams.expertTitleApprovalDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择专家称号批准时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="专家称号终止时间" prop="expertTitleTerminationDate">
        <el-date-picker clearable
                        v-model="queryParams.expertTitleTerminationDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择专家称号终止时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['business:employeeInfo:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['business:employeeInfo:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['business:employeeInfo:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['business:employeeInfo:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="employeeInfoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['business:employeeInfo:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['business:employeeInfo:remove']"
          >删除</el-button>
        </template>
      </el-table-column>

      <el-table-column label="员工照片地址" align="center" prop="photoUrl" width="100">
        <template slot-scope="scope">
          <image-preview :src="scope.row.photoUrl" :width="50" :height="50"/>
        </template>
      </el-table-column>

      <el-table-column label="人员编号" align="center" prop="employeeId" />
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="单位名称" align="center" prop="companyName" />
      <el-table-column label="部门名称" align="center" prop="departmentName" />
      <el-table-column label="部门类别" align="center" prop="departmentType" />
      <el-table-column label="班组/处室" align="center" prop="teamOffice" />
      <el-table-column label="岗位名称" align="center" prop="positionName" />
      <el-table-column label="岗位大类" align="center" prop="positionCategoryMajor" />
      <el-table-column label="岗位中类" align="center" prop="positionCategoryMinor" />
      <el-table-column label="性别 男 女" align="center" prop="gender" />
      <el-table-column label="民族" align="center" prop="ethnicity" />
      <el-table-column label="出生日期" align="center" prop="birthDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.birthDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="参加工作时间" align="center" prop="workStartDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.workStartDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="工龄起算日期" align="center" prop="workTenureStartDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.workTenureStartDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="进入电力行业时间" align="center" prop="entryPowerIndustryDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.entryPowerIndustryDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="进入本单位时间" align="center" prop="entryCompanyDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.entryCompanyDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最高学历毕业时间" align="center" prop="highestEducationGraduationDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.highestEducationGraduationDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最高学历学校名称" align="center" prop="highestEducationSchoolName" />
      <el-table-column label="最高学历所学专业名称" align="center" prop="highestEducationMajor" />
      <el-table-column label="最高学历学习形式 全日制, 函授, 在职, 自学考试, 网络教育, 成人教育" align="center" prop="highestEducationForm" />
      <el-table-column label="最高学历" align="center" prop="highestEducationDegree" />
      <el-table-column label="最高学位" align="center" prop="highestEducationTitle" />
      <el-table-column label="就业学历毕业时间" align="center" prop="employmentEducationGraduationDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.employmentEducationGraduationDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="就业学历学校名称" align="center" prop="employmentEducationSchoolName" />
      <el-table-column label="就业学历所学专业名称" align="center" prop="employmentEducationMajor" />
      <el-table-column label="就业学历学习形式" align="center" prop="employmentEducationForm" />
      <el-table-column label="就业学历" align="center" prop="employmentEducationDegree" />
      <el-table-column label="就业学位" align="center" prop="employmentEducationTitle" />
      <el-table-column label="政治面貌" align="center" prop="politicalAffiliation" />
      <el-table-column label="入组织时间" align="center" prop="partyEntryDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.partyEntryDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="转正时间" align="center" prop="probationEndDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.probationEndDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="专家等级" align="center" prop="expertLevel" />
      <el-table-column label="专家类别" align="center" prop="expertCategory" />
      <el-table-column label="专业技术资格名称" align="center" prop="professionalQualificationName" />
      <el-table-column label="专业技术资格系列" align="center" prop="professionalQualificationSeries" />
      <el-table-column label="专业技术资格等级" align="center" prop="professionalQualificationLevel" />
      <el-table-column label="取得资格时间" align="center" prop="qualificationObtainDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.qualificationObtainDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="技能鉴定工种" align="center" prop="skillIdentificationTrade" />
      <el-table-column label="技能等级" align="center" prop="skillLevel" />
      <el-table-column label="资格获得时间" align="center" prop="skillQualificationObtainDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.skillQualificationObtainDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="任职时间" align="center" prop="appointmentDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.appointmentDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="现职务名称" align="center" prop="currentPositionName" />
      <el-table-column label="专家称号批准时间" align="center" prop="expertTitleApprovalDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.expertTitleApprovalDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="专家称号终止时间" align="center" prop="expertTitleTerminationDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.expertTitleTerminationDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="专家人才类型" align="center" prop="expertTalentType" />


      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="年度" align="center" prop="awardYear" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.awardYear, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改员工信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="form.remarks" placeholder="请输入备注" />
        </el-form-item>
        <el-form-item label="年度" prop="awardYear">
          <el-date-picker clearable
                          v-model="form.awardYear"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择年度">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="人员编号" prop="employeeId">
          <el-input v-model="form.employeeId" placeholder="请输入人员编号" />
        </el-form-item>
        <el-form-item label="姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入姓名" />
        </el-form-item>
        <el-form-item label="单位名称" prop="companyName">
          <el-input v-model="form.companyName" placeholder="请输入单位名称" />
        </el-form-item>
        <el-form-item label="部门名称" prop="departmentName">
          <el-input v-model="form.departmentName" placeholder="请输入部门名称" />
        </el-form-item>
        <el-form-item label="班组/处室" prop="teamOffice">
          <el-input v-model="form.teamOffice" placeholder="请输入班组/处室" />
        </el-form-item>
        <el-form-item label="岗位名称" prop="positionName">
          <el-input v-model="form.positionName" placeholder="请输入岗位名称" />
        </el-form-item>
        <el-form-item label="岗位大类" prop="positionCategoryMajor">
          <el-input v-model="form.positionCategoryMajor" placeholder="请输入岗位大类" />
        </el-form-item>
        <el-form-item label="岗位中类" prop="positionCategoryMinor">
          <el-input v-model="form.positionCategoryMinor" placeholder="请输入岗位中类" />
        </el-form-item>
        <el-form-item label="性别 男 女" prop="gender">
          <el-input v-model="form.gender" placeholder="请输入性别 男 女" />
        </el-form-item>
        <el-form-item label="民族" prop="ethnicity">
          <el-input v-model="form.ethnicity" placeholder="请输入民族" />
        </el-form-item>
        <el-form-item label="出生日期" prop="birthDate">
          <el-date-picker clearable
                          v-model="form.birthDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择出生日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="年龄" prop="age">
          <el-input v-model="form.age" placeholder="请输入年龄" />
        </el-form-item>
        <el-form-item label="参加工作时间" prop="workStartDate">
          <el-date-picker clearable
                          v-model="form.workStartDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择参加工作时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="工龄起算日期" prop="workTenureStartDate">
          <el-date-picker clearable
                          v-model="form.workTenureStartDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择工龄起算日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="进入电力行业时间" prop="entryPowerIndustryDate">
          <el-date-picker clearable
                          v-model="form.entryPowerIndustryDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择进入电力行业时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="进入本单位时间" prop="entryCompanyDate">
          <el-date-picker clearable
                          v-model="form.entryCompanyDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择进入本单位时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最高学历毕业时间" prop="highestEducationGraduationDate">
          <el-date-picker clearable
                          v-model="form.highestEducationGraduationDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择最高学历毕业时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最高学历学校名称" prop="highestEducationSchoolName">
          <el-input v-model="form.highestEducationSchoolName" placeholder="请输入最高学历学校名称" />
        </el-form-item>
        <el-form-item label="最高学历所学专业名称" prop="highestEducationMajor">
          <el-input v-model="form.highestEducationMajor" placeholder="请输入最高学历所学专业名称" />
        </el-form-item>
        <el-form-item label="最高学历学习形式 全日制, 函授, 在职, 自学考试, 网络教育, 成人教育" prop="highestEducationForm">
          <el-input v-model="form.highestEducationForm" placeholder="请输入最高学历学习形式 全日制, 函授, 在职, 自学考试, 网络教育, 成人教育" />
        </el-form-item>
        <el-form-item label="最高学历" prop="highestEducationDegree">
          <el-input v-model="form.highestEducationDegree" placeholder="请输入最高学历" />
        </el-form-item>
        <el-form-item label="最高学位" prop="highestEducationTitle">
          <el-input v-model="form.highestEducationTitle" placeholder="请输入最高学位" />
        </el-form-item>
        <el-form-item label="就业学历毕业时间" prop="employmentEducationGraduationDate">
          <el-date-picker clearable
                          v-model="form.employmentEducationGraduationDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择就业学历毕业时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="就业学历学校名称" prop="employmentEducationSchoolName">
          <el-input v-model="form.employmentEducationSchoolName" placeholder="请输入就业学历学校名称" />
        </el-form-item>
        <el-form-item label="就业学历所学专业名称" prop="employmentEducationMajor">
          <el-input v-model="form.employmentEducationMajor" placeholder="请输入就业学历所学专业名称" />
        </el-form-item>
        <el-form-item label="就业学历" prop="employmentEducationDegree">
          <el-input v-model="form.employmentEducationDegree" placeholder="请输入就业学历" />
        </el-form-item>
        <el-form-item label="就业学位" prop="employmentEducationTitle">
          <el-input v-model="form.employmentEducationTitle" placeholder="请输入就业学位" />
        </el-form-item>
        <el-form-item label="政治面貌" prop="politicalAffiliation">
          <el-input v-model="form.politicalAffiliation" placeholder="请输入政治面貌" />
        </el-form-item>
        <el-form-item label="入组织时间" prop="partyEntryDate">
          <el-date-picker clearable
                          v-model="form.partyEntryDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择入组织时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="转正时间" prop="probationEndDate">
          <el-date-picker clearable
                          v-model="form.probationEndDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择转正时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="专家等级" prop="expertLevel">
          <el-input v-model="form.expertLevel" placeholder="请输入专家等级" />
        </el-form-item>
        <el-form-item label="专家类别" prop="expertCategory">
          <el-input v-model="form.expertCategory" placeholder="请输入专家类别" />
        </el-form-item>
        <el-form-item label="专业技术资格名称" prop="professionalQualificationName">
          <el-input v-model="form.professionalQualificationName" placeholder="请输入专业技术资格名称" />
        </el-form-item>
        <el-form-item label="专业技术资格系列" prop="professionalQualificationSeries">
          <el-input v-model="form.professionalQualificationSeries" placeholder="请输入专业技术资格系列" />
        </el-form-item>
        <el-form-item label="专业技术资格等级" prop="professionalQualificationLevel">
          <el-input v-model="form.professionalQualificationLevel" placeholder="请输入专业技术资格等级" />
        </el-form-item>
        <el-form-item label="取得资格时间" prop="qualificationObtainDate">
          <el-date-picker clearable
                          v-model="form.qualificationObtainDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择取得资格时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="技能鉴定工种" prop="skillIdentificationTrade">
          <el-input v-model="form.skillIdentificationTrade" placeholder="请输入技能鉴定工种" />
        </el-form-item>
        <el-form-item label="技能等级" prop="skillLevel">
          <el-input v-model="form.skillLevel" placeholder="请输入技能等级" />
        </el-form-item>
        <el-form-item label="资格获得时间" prop="skillQualificationObtainDate">
          <el-date-picker clearable
                          v-model="form.skillQualificationObtainDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择资格获得时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="任职时间" prop="appointmentDate">
          <el-date-picker clearable
                          v-model="form.appointmentDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择任职时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="现职务名称" prop="currentPositionName">
          <el-input v-model="form.currentPositionName" placeholder="请输入现职务名称" />
        </el-form-item>
        <el-form-item label="专家称号批准时间" prop="expertTitleApprovalDate">
          <el-date-picker clearable
                          v-model="form.expertTitleApprovalDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择专家称号批准时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="专家称号终止时间" prop="expertTitleTerminationDate">
          <el-date-picker clearable
                          v-model="form.expertTitleTerminationDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          placeholder="请选择专家称号终止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="员工照片地址" prop="photoUrl">
          <image-upload v-model="form.photoUrl"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listEmployeeInfo, getEmployeeInfo, delEmployeeInfo, addEmployeeInfo, updateEmployeeInfo } from "@/api/business/employeeInfo";

export default {
  name: "EmployeeInfo",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 员工信息表格数据
      employeeInfoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 员工照片地址时间范围
      daterangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        remarks: null,
        awardYear: null,
        createTime: null,
        employeeId: null,
        name: null,
        companyName: null,
        departmentName: null,
        departmentType: null,
        teamOffice: null,
        positionName: null,
        positionCategoryMajor: null,
        positionCategoryMinor: null,
        gender: null,
        ethnicity: null,
        birthDate: null,
        age: null,
        workStartDate: null,
        workTenureStartDate: null,
        entryPowerIndustryDate: null,
        entryCompanyDate: null,
        highestEducationGraduationDate: null,
        highestEducationSchoolName: null,
        highestEducationMajor: null,
        highestEducationForm: null,
        highestEducationDegree: null,
        highestEducationTitle: null,
        employmentEducationGraduationDate: null,
        employmentEducationSchoolName: null,
        employmentEducationMajor: null,
        employmentEducationForm: null,
        employmentEducationDegree: null,
        employmentEducationTitle: null,
        politicalAffiliation: null,
        partyEntryDate: null,
        probationEndDate: null,
        expertLevel: null,
        expertCategory: null,
        professionalQualificationName: null,
        professionalQualificationSeries: null,
        professionalQualificationLevel: null,
        qualificationObtainDate: null,
        skillIdentificationTrade: null,
        skillLevel: null,
        skillQualificationObtainDate: null,
        appointmentDate: null,
        currentPositionName: null,
        expertTitleApprovalDate: null,
        expertTitleTerminationDate: null,
        expertTalentType: null,
        photoUrl: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        name: [
          { required: true, message: "姓名不能为空", trigger: "blur" }
        ],
        companyName: [
          { required: true, message: "单位名称不能为空", trigger: "blur" }
        ],
        departmentName: [
          { required: true, message: "部门名称不能为空", trigger: "blur" }
        ],
        departmentType: [
          { required: true, message: "部门类别不能为空", trigger: "change" }
        ],
        positionName: [
          { required: true, message: "岗位名称不能为空", trigger: "blur" }
        ],
        positionCategoryMajor: [
          { required: true, message: "岗位大类不能为空", trigger: "blur" }
        ],
        positionCategoryMinor: [
          { required: true, message: "岗位中类不能为空", trigger: "blur" }
        ],
        gender: [
          { required: true, message: "性别 男 女不能为空", trigger: "blur" }
        ],
        ethnicity: [
          { required: true, message: "民族不能为空", trigger: "blur" }
        ],
        birthDate: [
          { required: true, message: "出生日期不能为空", trigger: "blur" }
        ],
        age: [
          { required: true, message: "年龄不能为空", trigger: "blur" }
        ],
        workStartDate: [
          { required: true, message: "参加工作时间不能为空", trigger: "blur" }
        ],
        workTenureStartDate: [
          { required: true, message: "工龄起算日期不能为空", trigger: "blur" }
        ],
        entryPowerIndustryDate: [
          { required: true, message: "进入电力行业时间不能为空", trigger: "blur" }
        ],
        entryCompanyDate: [
          { required: true, message: "进入本单位时间不能为空", trigger: "blur" }
        ],
        highestEducationGraduationDate: [
          { required: true, message: "最高学历毕业时间不能为空", trigger: "blur" }
        ],
        highestEducationSchoolName: [
          { required: true, message: "最高学历学校名称不能为空", trigger: "blur" }
        ],
        highestEducationMajor: [
          { required: true, message: "最高学历所学专业名称不能为空", trigger: "blur" }
        ],
        highestEducationForm: [
          { required: true, message: "最高学历学习形式 全日制, 函授, 在职, 自学考试, 网络教育, 成人教育不能为空", trigger: "blur" }
        ],
        highestEducationDegree: [
          { required: true, message: "最高学历不能为空", trigger: "blur" }
        ],
        politicalAffiliation: [
          { required: true, message: "政治面貌不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询员工信息列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
        this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
      }
      listEmployeeInfo(this.queryParams).then(response => {
        this.employeeInfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        remarks: null,
        awardYear: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        employeeId: null,
        name: null,
        companyName: null,
        departmentName: null,
        departmentType: null,
        teamOffice: null,
        positionName: null,
        positionCategoryMajor: null,
        positionCategoryMinor: null,
        gender: null,
        ethnicity: null,
        birthDate: null,
        age: null,
        workStartDate: null,
        workTenureStartDate: null,
        entryPowerIndustryDate: null,
        entryCompanyDate: null,
        highestEducationGraduationDate: null,
        highestEducationSchoolName: null,
        highestEducationMajor: null,
        highestEducationForm: null,
        highestEducationDegree: null,
        highestEducationTitle: null,
        employmentEducationGraduationDate: null,
        employmentEducationSchoolName: null,
        employmentEducationMajor: null,
        employmentEducationForm: null,
        employmentEducationDegree: null,
        employmentEducationTitle: null,
        politicalAffiliation: null,
        partyEntryDate: null,
        probationEndDate: null,
        expertLevel: null,
        expertCategory: null,
        professionalQualificationName: null,
        professionalQualificationSeries: null,
        professionalQualificationLevel: null,
        qualificationObtainDate: null,
        skillIdentificationTrade: null,
        skillLevel: null,
        skillQualificationObtainDate: null,
        appointmentDate: null,
        currentPositionName: null,
        expertTitleApprovalDate: null,
        expertTitleTerminationDate: null,
        expertTalentType: null,
        photoUrl: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加员工信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getEmployeeInfo(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改员工信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateEmployeeInfo(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addEmployeeInfo(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除员工信息编号为"' + ids + '"的数据项？').then(function() {
        return delEmployeeInfo(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/employeeInfo/export', {
        ...this.queryParams
      }, `employeeInfo_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
